home *** CD-ROM | disk | FTP | other *** search
/ Aminet 3 / Aminet 3 - July 1994.iso / Aminet / dev / obero / Interfaces3_4.lha / Interfaces / ASL.mod < prev    next >
Text File  |  1994-03-05  |  16KB  |  408 lines

  1. (*(********************************************************************
  2.  
  3. :Program.     ASL.mod
  4. :Contents.    interface module for asl.library
  5. :Copyright.   © 1992 by Fridtjof Siebert, Nicolas Benezan
  6. :Language.    Oberon-2
  7. :Translator.  Amiga Oberon Compiler V3.00
  8. :History.     V2.0 fridi 02-Nov-92
  9. :History.     V3.0 bene  20-Mar-92 updated to V39 includes
  10. :History.     V3.0b hG   21-May-93 rearranged, removed minor errors
  11. :History.     V3.1  hG   23-May-93 updated to V40 includes (40.5)
  12. :History.     40.15 hG   28-Dec-93 updated for V40.15
  13. :Version.     $VER: ASL.mod 40.15 (28.12.93) Oberon 3.0
  14.  
  15. ********************************************************************)*)
  16.  
  17. MODULE ASL;
  18.  
  19. (* !!! IMPORTANT NOTE !!!
  20.  * Before procedures of this module may be used, you have to check
  21.  * ASL.asl#NIL because opening ASL may fail on Amigas with KickStart
  22.  * 1.3 installed!
  23.  *)
  24.  
  25. IMPORT
  26.   e  * := Exec, u  * := Utility, wb * := Workbench, g  * := Graphics;
  27.  
  28. (*****************************************************************************)
  29.  
  30. CONST
  31.   aslName * = "asl.library";
  32.   aslTag  * = u.user + 80000H;
  33.  
  34.  
  35. (*****************************************************************************)
  36.  
  37.  
  38. (* Types of requesters known to ASL, used as arguments to AllocAslRequest() *)
  39.   fileRequest       * = 0;
  40.   fontRequest       * = 1;
  41.   screenModeRequest * = 2;
  42.  
  43.  
  44. (************************************************************************)
  45. CONST
  46. (*
  47.  * common tag arguments
  48.  *)
  49.  
  50.  
  51. (* Window control *)
  52.   window         * = aslTag+2;   (* Parent window                    *)
  53.   screen         * = aslTag+40;  (* Screen to open on if no window   *)
  54.   pubScreenName  * = aslTag+41;  (* Name of public screen            *)
  55.   privateIDCMP   * = aslTag+42;  (* Allocate private IDCMP?          *)
  56.   intuiMsgFunc   * = aslTag+70;  (* Function to handle IntuiMessages *)
  57.   sleepWindow    * = aslTag+43;  (* Block input in ASLFO_WindoU?     *)
  58.   userData       * = aslTag+52;  (* What to put in fo_UserData       *)
  59.  
  60. (* Text display *)
  61.   textAttr       * = aslTag+51;  (* Text font to use for gadget text *)
  62.   locale         * = aslTag+50;  (* Locale ASL should use for text   *)
  63.   titleText      * = aslTag+1;   (* Title of requester               *)
  64.   positiveText   * = aslTag+18;  (* Positive gadget text             *)
  65.   negativeText   * = aslTag+19;  (* Negative gadget text             *)
  66.  
  67. (* Initial settings *)
  68.   initialLeftEdge * = aslTag+3;   (* Initial requester coordinates    *)
  69.   initialTopEdge  * = aslTag+4;
  70.   initialWidth    * = aslTag+5;   (* Initial requester dimensions     *)
  71.   initialHeight   * = aslTag+6;
  72.  
  73. (* Filtering *)
  74.   filterFunc     * = aslTag+49;  (* Function to filter fonts         *)
  75.   hookFunc       * = aslTag+7;   (* Combined callback function       *)
  76.  
  77. TYPE
  78.   ASLRequesterPtr * = UNTRACED POINTER TO ASLRequester;
  79.   ASLRequester * = STRUCT END;
  80.  
  81. (*****************************************************************************
  82.  *
  83.  * ASL File Requester data structures and constants
  84.  *
  85.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  86.  * Control of the various fields is provided via tags when the requester
  87.  * is created with AllocAslRequest() and when it is displayed via
  88.  * AslRequest()
  89.  *)
  90.   FileRequesterPtr * = UNTRACED POINTER TO FileRequester;
  91.   FileRequester * = STRUCT (dummy *: ASLRequester)
  92.     reserved0 - : ARRAY 4 OF e.UBYTE;
  93.     file      - : e.LSTRPTR; (* Contents of File gadget on exit    *)
  94.     dir       - : e.LSTRPTR; (* Contents of Drawer gadget on exit  *)
  95.     reserved1 - : ARRAY 10 OF e.UBYTE;
  96.     leftEdge  - : INTEGER;   (* Coordinates of requester on exit   *)
  97.     topEdge   - : INTEGER;
  98.     width     - : INTEGER;
  99.     height    - : INTEGER;
  100.     reserved2 - : ARRAY 2 OF e.UBYTE;
  101.     numArgs   - : LONGINT;   (* Number of files selected           *)
  102.     argList   - : wb.WBArgumentsPtr; (* List of files selected     *)
  103.     userData  - : e.APTR;    (* You can store your own data here   *)
  104.     reserved3 - : ARRAY 8 OF e.UBYTE;
  105.     pat       - : e.LSTRPTR; (* Contents of Pattern gadget on exit *)
  106.   END;                       (* note - more reserved fields follow *)
  107.  
  108. CONST
  109. (* File requester tag values, used by AllocAslRequest() and AslRequest() *)
  110.  
  111. (* Window control *)
  112.   (* see common tags above *)
  113.  
  114. (* Text display *)
  115.   (* see common tags above *)
  116.  
  117. (* Initial settings *)
  118.   (* see common tags above *)
  119.   initialFile    * = aslTag+8;   (* Initial contents of File gadget  *)
  120.   initialDrawer  * = aslTag+9;   (* Initial contents of Drawer gadg. *)
  121.   initialPattern * = aslTag+10;  (* Initial contents of Pattern gadg.*)
  122.  
  123. (* Options *)
  124.   flags1         * = aslTag+20;  (* Option flags                     *)
  125.   flags2         * = aslTag+22;  (* Additional option flags          *)
  126.   doSaveMode     * = aslTag+44;  (* Being used for saving?           *)
  127.   doMultiSelect  * = aslTag+45;  (* Do multi-select?                 *)
  128.   doPatterns     * = aslTag+46;  (* Display a Pattern gadget?        *)
  129.  
  130. (* Filtering *)
  131.   (* see common tags above *)
  132.   drawersOnly    * = aslTag+47;  (* Don't display files?             *)
  133.   rejectIcons    * = aslTag+60;  (* Display .info files?             *)
  134.   rejectPattern  * = aslTag+61;  (* Don't display files matching pat *)
  135.   acceptPattern  * = aslTag+62;  (* Accept only files matching pat   *)
  136.   filterDrawers  * = aslTag+63;  (* Also filter drawers with patterns*)
  137.  
  138.  
  139. (* Flag bits for the ASLFR_Flags1 tag *)
  140.   frFilterFunc    * = 7;
  141.   frIntuiFunc     * = 6;
  142.   frDoSaveMode    * = 5;
  143.   frPrivateIDCMP  * = 4;
  144.   frDoMultiSelect * = 3;
  145.   frDoPatterns    * = 0;
  146.  
  147. (* Flag bits for the ASLFR_Flags2 tag *)
  148.   frDrawersOnly   * = 0; (* Do not want a file gadget, no files shown      *)
  149.   frFilterDrawers * = 1; (* filter drawers by matching pattern             *)
  150.   frRejectIcons   * = 2;
  151.  
  152.  
  153. (*****************************************************************************
  154.  *
  155.  * ASL Font Requester data structures and constants
  156.  *
  157.  * This structure must only be allocated by asl.library amd is READ-ONLY!
  158.  * Control of the various fields is provided via tags when the requester
  159.  * is created with AllocAslRequest() and when it is displayed via
  160.  * AslRequest()
  161.  *)
  162. TYPE
  163.   FontRequesterPtr * = UNTRACED POINTER TO FontRequester;
  164.   FontRequester * = STRUCT (dummy *: ASLRequester)
  165.     reserved0 - : ARRAY 8 OF e.UBYTE;
  166.     attr      - : g.TextAttr;  (* Returned TextAttr                *)
  167.     frontPen  - : SHORTINT;    (* Returned front pen               *)
  168.     backPen   - : SHORTINT;    (* Returned back pen                *)
  169.     drawMode  - : SHORTSET;    (* Returned drawing mode            *)
  170.     reserved1 - : e.UBYTE;
  171.     userData  - : e.APTR;      (* You can store your own data here *)
  172.     leftEdge  - : INTEGER;     (* Coordinates of requester on exit *)
  173.     topEdge   - : INTEGER;
  174.     width     - : INTEGER;
  175.     height    - : INTEGER;
  176.     tAttr     - : g.TTextAttr; (* Returned TTextAttr               *)
  177.   END;
  178.  
  179. CONST
  180. (* Font requester tag values, used by AllocAslRequest() and AslRequest() *)
  181.  
  182. (* Window control *)
  183.   (* see common tags above *)
  184.  
  185. (* Text display *)
  186.   (* see common tags above *)
  187.  
  188. (* Initial settings *)
  189.   (* see common tags above *)
  190.   initialName     * = aslTag+10;  (* Initial contents of Name gadget  *)
  191.   initialSize     * = aslTag+11;  (* Initial contents of Size gadget  *)
  192.   initialStyle    * = aslTag+12;  (* Initial font style               *)
  193.   initialFlags    * = aslTag+13;  (* Initial font flags for TextAttr  *)
  194.   initialFrontPen * = aslTag+14;  (* Initial front pen                *)
  195.   initialBackPen  * = aslTag+15;  (* Initial back pen                 *)
  196.   initialDrawMode * = aslTag+59;  (* Initial draw mode                *)
  197.  
  198. (* Options *)
  199.   flags          * = aslTag+20;  (* Option flags                     *)
  200.   doFrontPen     * = aslTag+44;  (* Display Front color selector?    *)
  201.   doBackPen      * = aslTag+45;  (* Display Back color selector?     *)
  202.   doStyle        * = aslTag+46;  (* Display Style checkboxes?        *)
  203.   doDrawMode     * = aslTag+47;  (* Display DrawMode cycle gadget?   *)
  204.  
  205. (* Filtering *)
  206.   fixedWidthOnly * = aslTag+48;  (* Only allow fixed-width fonts?    *)
  207.   minHeight      * = aslTag+16;  (* Minimum font height to display   *)
  208.   maxHeight      * = aslTag+17;  (* Maximum font height to display   *)
  209.   maxFrontPen    * = aslTag+66;  (* Max # of colors in front palette *)
  210.   maxBackPen     * = aslTag+67;  (* Max # of colors in back palette  *)
  211.  
  212. (* Custom additions *)
  213.   modeList       * = aslTag+21;  (* Substitute list for drawmodes    *)
  214.   frontPens      * = aslTag+64;  (* Color table for front pen palette*)
  215.   backPens       * = aslTag+65;  (* Color table for back pen palette *)
  216.  
  217.  
  218. (* Flag bits for ASLFO_Flags tag *)
  219.   foDoFrontPen     * = 0;
  220.   foDoBackPen      * = 1;
  221.   foDoStyle        * = 2;
  222.   foDoDrawMode     * = 3;
  223.   foFixedWidthOnly * = 4;
  224.   foPrivateIDCMP   * = 5;
  225.   foIntuiFunc      * = 6;
  226.   foFilterFunc     * = 7;
  227.  
  228. TYPE
  229. (*****************************************************************************
  230.  *
  231.  * ASL Screen Mode Requester data structures and constants
  232.  *
  233.  * This structure must only be allocated by asl.library and is READ-ONLY!
  234.  * Control of the various fields is provided via tags when the requester
  235.  * is created with AllocAslRequest() and when it is displayed via
  236.  * AslRequest()
  237.  *)
  238.   ScreenModeRequesterPtr * = UNTRACED POINTER TO ScreenModeRequester;
  239.   ScreenModeRequester * = STRUCT (dummy *: ASLRequester)
  240.     displayID     - : LONGINT;  (* Display mode ID                  *)
  241.     displayWidth  - : LONGINT;  (* Width of display in pixels       *)
  242.     displayHeight - : LONGINT;  (* Height of display in pixels      *)
  243.     displayDepth  - : INTEGER;  (* Number of bit-planes of display  *)
  244.     overscanType  - : INTEGER;  (* Type of overscan of display      *)
  245.     autoScroll    - : BOOLEAN;  (* Display should auto-scroll?      *)
  246.     pad1            : SHORTINT;
  247.  
  248.     bitMapWidth   - : LONGINT;  (* Used to create your own BitMap   *)
  249.     bitMapHeight  - : LONGINT;
  250.  
  251.     leftEdge      - : INTEGER;  (* Coordinates of requester on exit *)
  252.     topEdge       - : INTEGER;
  253.     width         - : INTEGER;
  254.     height        - : INTEGER;
  255.  
  256.     infoOpened    - : BOOLEAN;  (* Info window opened on exit?      *)
  257.     pad2            : SHORTINT;
  258.     infoLeftEdge  - : INTEGER;  (* Last coordinates of Info window  *)
  259.     infoTopEdge   - : INTEGER;
  260.     infoWidth     - : INTEGER;
  261.     infoHeight    - : INTEGER;
  262.  
  263.     userData      - : e.APTR;   (* You can store your own data here *)
  264.   END;
  265.  
  266. (* An Exec list of custom modes can be added to the list of available modes.
  267.  * The DimensionInfo structure must be completely initialized, including the
  268.  * Header. See <graphics/displayinfo.h>. Custom mode ID's must be in the range
  269.  * 0xFFFF0000..0xFFFFFFFF. Regular properties which apply to your custom modes
  270.  * can be added in the dn_PropertyFlags field. Custom properties are not
  271.  * allowed.
  272.  *)
  273.  
  274. TYPE
  275.   DisplayMode* = STRUCT (node * : e.Node) (* see ln_Name           *)
  276.     dimensionInfo * : g.DimensionInfo;    (* mode description      *)
  277.     propertyFlags * : LONGSET;            (* applicable properties *)
  278.   END;
  279.  
  280. CONST
  281. (* ScreenMode requester tag values, used by AllocAslRequest() and AslRequest() *)
  282.  
  283. (* Window control *)
  284.   (* see common tags above *)
  285.  
  286. (* Text display *)
  287.   (* see common tags above *)
  288.  
  289. (* Initial settings *)
  290.   (* see common tags above *)
  291.   initialDisplayID    * = aslTag+100; (* Initial display mode id     *)
  292.   initialDisplayWidth * = aslTag+101; (* Initial display width       *)
  293.   initialDisplayHeight* = aslTag+102; (* Initial display height      *)
  294.   initialDisplayDepth * = aslTag+103; (* Initial display depth       *)
  295.   initialOverscanType * = aslTag+104; (* Initial type of overscan    *)
  296.   initialAutoScroll   * = aslTag+105; (* Initial autoscroll setting  *)
  297.   initialInfoOpened   * = aslTag+106; (* Info wndw initially opened? *)
  298.   initialInfoLeftEdge * = aslTag+107; (* Initial Info window coords. *)
  299.   initialInfoTopEdge  * = aslTag+108;
  300.  
  301. (* Options *)
  302.   doWidth        * = aslTag+109;  (* Display Width gadget?           *)
  303.   doHeight       * = aslTag+110;  (* Display Height gadget?          *)
  304.   doDepth        * = aslTag+111;  (* Display Depth gadget?           *)
  305.   doOverscanType * = aslTag+112;  (* Display Overscan Type gadget?   *)
  306.   doAutoScroll   * = aslTag+113;  (* Display AutoScroll gadget?      *)
  307.  
  308. (* Filtering *)
  309.   smPropertyFlags* = aslTag+114;  (* Must have these Property flags  *)
  310.   smPropertyMask * = aslTag+115;  (* Only these should be looked at  *)
  311.   smMinWidth     * = aslTag+116;  (* Minimum display width to allow  *)
  312.   smMaxWidth     * = aslTag+117;  (* Maximum display width to allow  *)
  313.   smMinHeight    * = aslTag+118;  (* Minimum display height to allow *)
  314.   smMaxHeight    * = aslTag+119;  (* Maximum display height to allow *)
  315.   smMinDepth     * = aslTag+120;  (* Minimum display depth           *)
  316.   smMaxDepth     * = aslTag+121;  (* Maximum display depth           *)
  317.   smFilterFunc   * = aslTag+122;  (* Function to filter mode id's    *)
  318.  
  319. (* Custom additions *)
  320.   customSMList   * = aslTag+123;  (* Exec list of struct DisplayMode *)
  321.  
  322. (***********************************************************************
  323.  *
  324.  * Obsolete ASL definitions, here for source code compatibility only.
  325.  * Please do NOT use in new code.
  326.  *
  327.  *)
  328.   fonFrontColor * = 0;
  329.   fonBackColor  * = 1;
  330.   fonStyles     * = 2;
  331.   fonDrawMode   * = 3;
  332.   fonFixedWidth * = 4;
  333.   fonNewIDCMP   * = 5;
  334.   fonDoMsgFunc  * = 6;
  335.   fonDoWildFunc * = 7;
  336.  
  337.   doWildFunc   * = frFilterFunc;
  338.   doMsgFunc    * = frIntuiFunc;
  339.   save         * = frDoSaveMode;
  340.   newIDCMP     * = frPrivateIDCMP;
  341.   multiSelect  * = frDoMultiSelect;
  342.   patGad       * = frDoPatterns;
  343.   noFiles      * = frDrawersOnly;
  344.  
  345.   aslDummy    * = aslTag;
  346.  
  347.   hail        * = aslDummy+1;    (* Hailing text follows              *)
  348.   leftEdge    * = aslDummy+3;    (* Initialize LeftEdge               *)
  349.   topEdge     * = aslDummy+4;    (* Initialize TopEdge                *)
  350.   width       * = aslDummy+5;
  351.   height      * = aslDummy+6;
  352.  
  353. (* Tags specific to file request                                             *)
  354.   file        * = aslDummy+8;    (* Initial name of file follows      *)
  355.   dir         * = aslDummy+9;    (* Initial string of filerequest dir *)
  356.  
  357. (* Tags specific to font request                                             *)
  358.   fontName    * = aslDummy+10;   (* Initial font name                 *)
  359.   fontHeight  * = aslDummy+11;   (* Initial font height               *)
  360.   fontStyles  * = aslDummy+12;   (* Initial font styles               *)
  361.   fontFlags   * = aslDummy+13;   (* Initial font flags for textattr   *)
  362.   frontPen    * = aslDummy+14;   (* Initial frontpen color            *)
  363.   backPen     * = aslDummy+15;   (* Initial backpen color             *)
  364.  
  365.   okText      * = aslDummy+18;   (* Text displayed in OK gadget       *)
  366.   cancelText  * = aslDummy+19;   (* Text displayed in CANCEL gadget   *)
  367.   funcFlags   * = aslDummy+20;   (* Function flags, depend on request *)
  368.  
  369.   extFlags1   * = aslDummy+22;   (* For passing extended FIL1F flags   *)
  370.  
  371.   pattern     * = fontName;      (* File requester pattern string     *)
  372.  
  373. (******** END of ASL Tag values *****************************************)
  374.  
  375. VAR
  376.   asl *, base * : e.LibraryPtr; (* synonyms *)
  377.  
  378. (*--- functions in V36 or higher (Release 2.0) ---*)
  379.  
  380. (* OBSOLETE -- Please use the generic requester functions instead *)
  381.  
  382. PROCEDURE AllocFileRequest   *{asl,- 30}(): FileRequesterPtr;
  383. PROCEDURE FreeFileRequest    *{asl,- 36}(fileReq{8} : FileRequesterPtr);
  384. PROCEDURE RequestFile        *{asl,- 42}(fileReq{8} : FileRequesterPtr): BOOLEAN;
  385.  
  386.  
  387. PROCEDURE AllocAslRequest    *{asl,- 48}(reqType{0}  : LONGINT;
  388.                                          tagList{8}  : ARRAY OF u.TagItem): ASLRequesterPtr;
  389. PROCEDURE AllocAslRequestTags*{asl,- 48}(reqType{0}  : LONGINT;
  390.                                          tag1{8}..   : u.Tag): ASLRequesterPtr;
  391. PROCEDURE FreeAslRequest     *{asl,- 54}(requester{8}: ASLRequesterPtr);
  392. PROCEDURE AslRequest         *{asl,- 60}(requester{8}: ASLRequesterPtr;
  393.                                          tagList{9}  : ARRAY OF u.TagItem): BOOLEAN;
  394. PROCEDURE AslRequestTags     *{asl,- 60}(requester{8}: ASLRequesterPtr;
  395.                                          tag1{9}..   : u.Tag): BOOLEAN;
  396.  
  397. (* $OvflChk- $RangeChk- $StackChk- $NilChk- $ReturnChk- $CaseChk- *)
  398.  
  399. BEGIN
  400.   asl :=  e.OpenLibrary (aslName, 37);
  401.   base := asl;
  402.  
  403. CLOSE
  404.   IF asl # NIL THEN e.CloseLibrary(asl) END;
  405.  
  406. END ASL.
  407.  
  408.